<?php
    @header("Content-type:text/html;charset=utf-8");
    @include_once("./connect.php");

    if(!isset($_POST["phone"])){
        $obj=array();
        $obj["status"] = false;
        $obj["msg"] = "请输入参数";
        $json = json_encode($obj);
        exit($json);
    }

    $phone = $_POST["phone"];

    $sql = "SELECT * FROM `userinfo` where phone = '$phone'";

    $result = mysqli_query($conn,$sql);

    $obj = array();
    if($result){
        $item = mysqli_fetch_assoc($result);
        if($item){
            $obj["status"] = false;
            $obj["msg"] = "此手机号已被注册";
        }else{
            $obj["status"] = true;
        }
    }else{
        $obj["status"] = false;
        $obj["msg"] = "输入的sql语句有误";
        $obj["sql"] = $sql;
    }
    echo json_encode($obj)



?>